//
//  JournalViewModel.m
//  DataStatistics
//
//  Created by Kang on 15/12/30.
//  Copyright © 2015年 YTYangK. All rights reserved.
//

#import "JournalViewModel.h"


@interface JournalViewModel()
@end

@implementation JournalViewModel
singleton_for_implementation(JournalViewModel)


#pragma mrak - 删除日志
+ (void)requestWithUrlForChangePassword:(id)obj  andParam:(NSDictionary *)param success:(void(^)(JouList * model))success failure:(void(^)(NSString * error))failure{
    
    MDC_INTER_DIC(@"alarm/alarmRemove.asp", @"NetMethodPOST", @"ture")
    [super initRequestWithUrlObj:obj parametersDic:param Interface:inter success:^(id obj, id model) {
        
        
        if ([model[@"result"] intValue] != 1) {
            failure(@"删除失败");
            return;
        }
        success(model[@"result"]);
        
    } failure:^(id obj, NSString *err) {
        // [MBProgressHUD showError:err]; //返回是因为需要列表拉下来
        failure(err);
    }];
    
}


#pragma mrak - 日志列表
+ (void)requestWithUrlForJournal:(id)obj andParam:(NSDictionary *)param
                         success:(void(^)(NSMutableArray *model))success failure:(void(^)(NSString *error))failure {
    
    MDC_INTER_DIC(@"/alarmLog/findPage.do", @"NetMethodGET", @"false")
    [super initRequestWithUrlObj:obj parametersDic:param Interface:inter success:^(id obj, id model) {
        
        
        NSLog(@"%@",model);
        
            if ([model[@"alarmLogs"] count] == 0) {
            success(nil);
            
        }else{
            
            NSMutableArray *scheduingAry = [JouList mj_objectArrayWithKeyValuesArray:model[@"alarmLogs"]];
                success(scheduingAry);
        }
        
    } failure:^(id obj, NSString *err) {
        failure(err); //返回是因为需要列表拉下来
    }];
    
}





@end
